#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include "client.h"

int log_out (const char *name)
{
	int tmp;

	tmp = LOG_OUT;
	send(sock_fd, &tmp, sizeof(int), 0);

	tmp = strlen(name);
	send(sock_fd, &tmp, sizeof(int), 0);
	send(sock_fd, name, strlen(name), 0);

	recv(sock_fd, &tmp, sizeof(int), 0);
	return tmp;
}

#ifdef DEBUG
int main (int argc, char* argv[])
{
	if ( argc != 2)
	{
		printf ("usage: log_out username\n");
		exit (EXIT_FAILURE);
	}
	net_init();
	printf("res:\t%d\n", log_out(argv[1]));
}
#endif
